home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 98 / Skunkware 98.iso / osr5 / net / apache-1.3.0 / cntl / cqs < prev   
Text File  |  1998-07-07  |  8KB  |  271 lines

  1. #!/ibin/sh
  2. #******************************************************************************
  3. #                Apache Web Server cqs script
  4. #-----------------------------------------------------------------------------
  5. #    Adapted from the Netscape FastTrack @(#) cqs 5.2 96/08/14 
  6. #    by Ronald Joe Record (rr@sco.com) 07-Jul-98
  7. #-----------------------------------------------------------------------------
  8. #       input:
  9. #           $1 is the name of the step
  10. #           $2 is the keyword list (e.g. UPGRADE)
  11. #           $3 is the package list
  12. #=============================================================================
  13.  
  14. # Read arguments into variables
  15. scriptname="$0"
  16. keywords="$1"
  17. pkglist="$2"
  18.  
  19. # Source in the standard functions library, ccsSetup.sh
  20. . /ibin/ccsSetup.sh
  21.  
  22. # Set global variables that may be used elsehere in this script
  23.  
  24. CNTLDIR=${SSO_SHARED_ROOT}/cntl
  25.  
  26. OSR500_HERE=
  27. OSR502_HERE=
  28. OSR504_HERE=
  29. OSR505_HERE=
  30.  
  31. # some messages
  32.  
  33. CUSTOMFIX_MSG="\nProblems with the custom product databases have been detected and corrected.\nPlease exit the Software Manager (custom) completely and then restart\nthe installation of this product so that the Software Manager (custom) can\nuse the new database information. Continuing the installation without exiting \nand restarting the Software Manager (custom) will result in an unsupported\nconfiguration."
  34.  
  35. OS_MSG="\nThe following are supported Operating System environments for this\nproduct:\n\nSCO OpenServer 5.0.0\nSCO OpenServer 5.0.2\nSCO OpenServer 5.0.4\nSCO OpenServer 5.0.5\n\nNone of these products are installed on your system. Installation may \nresult in an unsupported configuration."
  36.  
  37. MSG_missPatch="WARNING: The following supplements(s) are STRONGLY recommended
  38.     for all systems running this software. You should install
  39.     these supplement(s) as soon as this product installation
  40.     is complete. The supplement(s) are available via anonymous ftp
  41.     from ftp.sco.com in the /SLS directory (ftp://ftp.sco.com/SLS/).
  42.     In particular, the Network Maintenance Supplement can be downloaded from 
  43.     ftp://ftp.sco.com/SLS/oss449f/ ."
  44.  
  45. MSG_noDB="ERROR: Cannot locate component database for _cmpnt_ component."
  46.  
  47. old_upgrade=
  48. sso_upgrade=
  49. iqm_file_exists=
  50. local_client=
  51. true_client=
  52. customMode=LAYERED
  53. for word in $keywords
  54. do
  55.     case "$word" in 
  56.         OLD_CUSTOM_UPGRADE) old_upgrade=TRUE
  57.                  ;;
  58.     UPGRADE)            sso_upgrade=TRUE
  59.         ;;
  60.     IQM_SAVE)        iqm_file_exists=TRUE
  61.                         customMode="IQM"
  62.         ;;
  63.     FOR_LOCAL_CLIENT)   local_client=TRUE
  64.         ;;
  65.     TRUE_CLIENT_ROOT)   true_client=TRUE
  66.         ;;
  67.     esac
  68. done
  69.  
  70. # Set the appropriate NLSPATH to enable the 'dspmsg' utility to work later
  71. # in this script.  
  72.  
  73. NLSPATH="${SSO_SHARED_ROOT}/cntl/msg/%L/%N.cat":"${NLSPATH}"
  74. export NLSPATH
  75.  
  76. #******************************************************************************
  77. #  cleanup --
  78. #
  79. #    cleanup exits the package script with the passed argument
  80. #
  81. #******************************************************************************
  82.  
  83. cleanup() {
  84.         exit $1
  85. }
  86.  
  87. #============================================================================
  88. #
  89. #
  90. # stop_start
  91. #
  92. # stops or starts servers
  93. #
  94. #============================================================================
  95. stop_start()
  96. {
  97.     STOP_START=$1
  98.     DIR=$2
  99.  
  100.     if [ -x "${DIR}"/"${STOP_START}"-admin ]
  101.     then
  102.         "${DIR}"/"${STOP_START}"-admin >/dev/null 2>/dev/null
  103.     fi
  104.  
  105.     for type in httpd https
  106.     do
  107.         for dir in `ls -d "${DIR}"/"${type}"* 2>/dev/null`
  108.         do
  109.             if [ -x "${dir}"/"${STOP_START}" ]
  110.             then
  111.                 "${dir}"/"${STOP_START}" >/dev/null 2>&1
  112.             fi
  113.         done
  114.     done
  115. }
  116.  
  117.  
  118. #=============================================================================
  119. #
  120. # getyn
  121. #
  122. # Prompt for yes or no answer - returns non-zero for no
  123. #
  124. # Usage: getyn "question"
  125. # Argument is a quoted question
  126. # Notes: getyn returns 0 if the answer is y or Y
  127. #        and 1 if the answer is n or N
  128. #        and 2 if the answer is q or Q
  129. #=============================================================================
  130. getyn() {
  131.         while   echo "$* (y/n/q) \c"
  132.         do      read yn rest
  133.                 case $yn in
  134.                 [yY])   return 0                                ;;
  135.                 [nN])   return 1                                ;;
  136.                 [qQ])   return 2                                ;;
  137.                 *)      echo "Please Make a selection\n"          ;;
  138.                 esac
  139.         done
  140. }
  141.  
  142. #=============================================================================
  143. # check_patch <patchID> <patchDescription>
  144. #
  145. # Check that a given patch is applied to the component that we are
  146. # working on. We need to check for this in the *client* databases.
  147. #=============================================================================
  148.  
  149. check_patch() {
  150.     if [ -f $CLIENT_DB ] ; then
  151.     pattern=`echo $1 | sed "s!\.!\\\\\.!g"`
  152.     pattern="patches.*[= ]${pattern}"
  153.  
  154.     grep -q "${pattern}" $CLIENT_DB
  155.     if [ $? -ne 0 ] ; then
  156.         List="$List\n\t$2"
  157.     fi
  158.     else
  159.     echo "\n$MSG_noDB" | sed "s!_cmpnt_!${CMPNT}!"
  160.     fi
  161. }
  162.  
  163. #====================================================================== INT ===
  164. #  main --
  165. #   
  166. #------------------------------------------------------------------------------
  167. #
  168. #
  169. # check for an OS first
  170.  
  171. if [ "${customMode}" = "LAYERED" ]
  172. then
  173.     component=`customquery ListComponents -p CONFIGURE SCO:Unix | grep "SCO:Unix" 2>/dev/null`
  174. else    # IQM install
  175.     if [ -x /ibin/uname ]
  176.     then
  177.         component=`/ibin/uname -X | grep Release | /ibin/awk '{ print $3 }' 2>/dev/null`
  178.     fi
  179. fi
  180.  
  181. echo "${component}" | grep "5.0.0" >/dev/null 2>&1
  182. if [ $? -eq 0 ]
  183. then
  184.         OSR500_HERE=TRUE
  185. fi
  186.  
  187. echo "${component}" | grep "5.0.2" >/dev/null 2>&1
  188. if [ $? -eq 0 ]
  189. then
  190.         OSR502_HERE=TRUE
  191. fi
  192.  
  193. echo "${component}" | grep "5.0.4" >/dev/null 2>&1
  194. if [ $? -eq 0 ]
  195. then
  196.         OSR504_HERE=TRUE
  197. fi
  198.  
  199. echo "${component}" | grep "5.0.5" >/dev/null 2>&1
  200. if [ $? -eq 0 ]
  201. then
  202.         OSR505_HERE=TRUE
  203. fi
  204.  
  205. # if this is 500, 502, 504 or 505, good, else,
  206. # inform of invalid configuration and ask to continue or not
  207.  
  208. if [ -n "${OSR504_HERE}" ] || [ -n "${OSR505_HERE}" ] || [ -n "${OSR500_HERE}" ] || [ -n "${OSR502_HERE}" ]
  209. then
  210.     continue
  211. else
  212.     ccsWarning "${OS_MSG}"
  213.     getyn "\nDo you wish to proceed with the installation? "
  214.     
  215.     if [ $? -eq 0 ]
  216.     then
  217.         continue
  218.     else
  219.         exit ${FAIL}
  220.     fi
  221. fi
  222.  
  223. # look for important supplements; print WARNING if NOT installed
  224.  
  225. [ "$customMode" = "LAYERED" ] && {
  226.     unixVer=`customquery ListComponents -p CONFIGURE SCO:Unix`
  227.  
  228.     case $unixVer in
  229.     SCO:Unix::5.0.0Cl)
  230.         CMPNT=Unix
  231.         CLIENT_DB=/var/opt/K/SCO/Unix/5.0.0Cl/.softmgmt/client.db
  232.         check_patch rs.Unix500.1 "SCO OpenServer Release 5 Release Supplement" 
  233.         check_patch rs.Unix500.2 "Networking Supplement Release 1.0"
  234.         check_patch rs.4.0 "SCO Internet Supplement for SCO OpenServer 5"
  235.         check_patch OSS449. "OSS449 Network Performance SLS"
  236.         [ "${List}" ] && {
  237.             echo "\n${MSG_missPatch}"
  238.             echo "${List}"
  239.         }
  240.         break
  241.         ;;
  242.     SCO:Unix::5.0.2Dp)
  243.         CMPNT=Unix
  244.         CLIENT_DB=/var/opt/K/SCO/Unix/5.0.2Dp/.softmgmt/client.db
  245.         check_patch rs.4.0 "SCO Internet Supplement for SCO OpenServer 5"
  246.         check_patch OSS449. "OSS449 Network Performance SLS"
  247.         [ "${List}" ] && {
  248.             echo "\n${MSG_missPatch}"
  249.             echo "${List}"
  250.         }
  251.         break
  252.         ;;
  253.     SCO:Unix::5.0.4Eb)
  254.         break
  255.         ;;
  256.     SCO:Unix::5.0.5*)
  257.         break
  258.         ;;
  259.     *)    echo "WARNING: Use of this product on this Operating System
  260.     environment is unsupported. You should be using
  261.     Release 5.0.0, 5.0.2, 5.0.4 or 5.0.5 of SCO OpenServer."
  262.         ;;
  263.     esac
  264. }
  265.  
  266. # the exit value from this script
  267.  
  268. cqs_return_value=0
  269.  
  270. exit $cqs_return_value
  271.